package com.google.code.jcooky.chat.client;

import java.awt.Color;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.border.LineBorder;
import javax.swing.SwingConstants;
import javax.swing.border.BevelBorder;
import javax.swing.JScrollPane;

public class MainFrame extends JFrame {

	private JPanel contentPane;
	private JList list;
	private JTextArea textArea;
	private JButton btnSend;
	private JTextArea textField;
	private JScrollPane scrollPane;
	private JScrollPane scrollPane_1;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			MainFrame frame = new MainFrameEvent();
			frame.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void onWindowClosing(WindowEvent e) {}
	public void onActiveSendBtn(ActionEvent e) {}

	/**
	 * Create the frame.
	 */
	public MainFrame() {
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				onWindowClosing(e);
			}
		});
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch(Exception e) {
			throw new RuntimeException(e);
		}
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 400);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		list = new JList(new DefaultListModel());
		list.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
		list.setBounds(12, 20, 90, 332);
		contentPane.add(list);
		
		JLabel label = new JLabel("\uC811\uC18D\uBAA9\uB85D");
		label.setAlignmentX(Component.CENTER_ALIGNMENT);
		label.setBounds(28, 0, 55, 15);
		contentPane.add(label);
		
		btnSend = new JButton("\uC804\uC1A1");
		btnSend.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				onActiveSendBtn(e);
			}
		});
		btnSend.setBounds(358, 291, 70, 61);
		contentPane.add(btnSend);
		
		scrollPane = new JScrollPane();
		scrollPane.setBounds(114, 10, 314, 271);
		contentPane.add(scrollPane);
		
		textArea = new JTextArea();
		textArea.setEditable(false);
		scrollPane.setViewportView(textArea);
		textArea.setDragEnabled(true);
		textArea.setLineWrap(true);
		textArea.setAlignmentY(Component.TOP_ALIGNMENT);
		textArea.setAlignmentX(Component.LEFT_ALIGNMENT);
		
		scrollPane_1 = new JScrollPane();
		scrollPane_1.setBounds(114, 293, 240, 59);
		contentPane.add(scrollPane_1);
		
		textField = new JTextArea();
		scrollPane_1.setViewportView(textField);
		textField.setTabSize(4);
		textField.setWrapStyleWord(true);
		textField.setAlignmentY(Component.TOP_ALIGNMENT);
		textField.setAlignmentX(Component.LEFT_ALIGNMENT);
		textField.setLineWrap(true);
	}
	public JList getConnectList() {
		return list;
	}
	public JTextArea getTextField() {
		return textField;
	}
	public JTextArea getTextArea() {
		return textArea;
	}
	public JButton getBtnSend() {
		return btnSend;
	}
}
